@isTest
private class ContractProductPDFControllerTest {
    static testMethod void testMethod1() {
        Id ldcProfile = [Select Id From Profile Where Name ='系统管理员' or Name='System Administrator'].Id;
        User u1 = new User( Alias = 'samLdc1', 
                         Email = 'ldc@test.com.maike',
                         Emailencodingkey = 'UTF-8', 
                         Lastname = '用户1', 
                         Languagelocalekey = 'en_US',
                         Localesidkey = 'en_US', 
                         Profileid = ldcProfile, 
                         Country = 'United States',
                         IsActive = true,
                         SubCompany__c='四川省迈克实业有限公司',
                         UserDepartment__c='客户服务中心(工程部)',
                         Timezonesidkey = 'America/Los_Angeles', 
                         EmployeeNumber = '123451',
                         Username = 'Matldc1@test.com.maike' );
        insert u1;
       
        
        // 客户
        Account acc = TestUtils.createAccount();
        acc.RecordTypeId = Utils.getRecordTypeIdByDevNameAndObjName('TerminalCustomer', 'Account');
        acc.BillingType__c = '专票';
        insert acc;
		
        
        // 业务机会
        Opportunity opp = TestUtils.createOpportunity();
        opp.AccountId = acc.Id;
        insert opp;
        
		ProductStructure__c ps2 = new ProductStructure__c();
        ps2.Classify3__c = '试剂';
        insert ps2;
        // 产品
        Product__c p = TestUtils.createProduct();
        p.bggsjhdj__c = 10.0;
        p.zl__c = '12.5ml';
        p.Purpose__c = '试剂报价用';
        p.ProductStructure__c = ps2.Id;
        
        Product__c p2 = TestUtils.createProduct();
        p2.Name = 'aaaa';
        p2.bggsjhdj__c = 10.0;
        p2.zl__c = '100ml';
        p2.Purpose__c = '试剂报价用';
        p2.ProductStructure__c = ps2.Id;
        
        Product__c p3 = TestUtils.createProduct();
        p3.Name = '测试合同产品';
        p3.bggsjhdj__c = 10.0;
        p3.zl__c = '200ml';
        p3.Purpose__c = '试剂报价用';
        p3.ProductStructure__c = ps2.Id;
        insert new Product__c[] {p, p2,p3};

          ///合同
        Contract__c c = new Contract__c();
        c.name = '测试合同';
        c.Account__c = acc.Id;
        c.TerminalCustomer__c = acc.Id;
        c.YearContract__c = String.valueOf(Date.today().year()) + '年经销商年度合同';
        insert c;
        
        ///合同产品
        ContractProduct__c  cp = new ContractProduct__c();
        cp.Contract__c = c.Id;
        cp.Product__c = p3.Id;
        insert cp;

        PageReference page = new PageReference('/apex/ContractProductPDF?conid=' + c.Id+'&type=1' );
        System.Test.setCurrentPage(page);
        ContractProductPDFController cpp = new ContractProductPDFController();








    }
}